﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Omu.ValueInjecter;

namespace Home.WebUI.Areas.Admin.Models
{
    /// <summary>
    /// 为空不映射
    /// </summary>
    public class ConvertNoNull : ConventionInjection
    {
        protected override bool Match(ConventionInfo c)
        {
            //名称相同
            if (c.SourceProp.Name == c.TargetProp.Name)
            {
                //如果为空不映射
                if (c.SourceProp.Value == null)
                {
                    return false;
                }
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}